/**
* Class representing a single instance of an interface implemented by a plugin component
*/
jsx3.lang.Class.defineClass("ux.core.util.component.ImplementedInterface",
        jsx3.lang.Object,
        null,
        function(config) {

            /**
            * Fully-qualified name of the interfacee that is implemented
            * @private
            */
            config.prototype.name = null;

            /**
            * Fully-qualified name of the class that implements the interface
            * @private
            */
            config.prototype.handlerClass = null;

            /**
            * Constructor for this class
            *
            * @param doc {jsx3.xml.Entity} xml node containing the information for a single implemented interface of a
            * plugin component
            *
            * @throws {ux.core.exception.InvalidComponentSchemaException} if the xml is invalid
            */
            config.prototype.init = function(doc) {
                this.jsxsuper();
                var children = doc.getChildNodes().iterator();
                while(children.hasNext()) {
                    var child = children.next();
                    var childName = child.getNodeName();
                    if(childName == "interface_name") {
                        this.name = child.getValue();
                    }
                    else if(childName == "impl_class") {
                        this.handlerClass = child.getValue();
                    }
                    else {
                        throw new ux.core.exception.InvalidComponentSchemaException("Unknown tag '" + childName + "' in the 'impl_interface' tag of the component schema.  Supported tags are: interface_name, impl_class");
                    }
                }
                if(!this.name) {
                    throw new ux.core.exception.InvalidComponentSchemaException("Tag 'interface_name' is a required child of 'impl_interface' tag.")
                }
                if(jsx3.util.strTrim(this.name.trim()) == "") {
                    throw new ux.core.exception.InvalidComponentSchemaException("Tag 'interface_name' may not be empty.")
                }
                if(!this.handlerClass) {
                    throw new ux.core.exception.InvalidComponentSchemaException("Tag 'impl_class' is a required child of 'impl_interface' tag.")
                }
                if(jsx3.util.strTrim(this.handlerClass.trim()) == "") {
                    throw new ux.core.exception.InvalidComponentSchemaException("Tag 'impl_class' may not be empty.")
                }
            }

            /**
            * Returns the fully-qualified name of the implemented interface.
            *
            * @return {String} the fully-qualified class name of the implemented interface
            */
            config.prototype.getName = function() {
                return this.name;
            }

            /**
            * Returns the fully-qualified name of the class that implements the interface.
            *
            * @return {String} the fully-qualified class name of the class that implements interface
            */
            config.prototype.getImplementationClass = function() {
                return this.handlerClass;
            }

            /**
            * Returns a string representing this object in the xml format specified by the component.xsd schema
            *
            * @param prepend {String} a string to be prepended to each line of the returned XML (useful for indenting)
            *
            * @returns {String} this Resources object as XML, as specified by the component.xsd schema
            */
            config.prototype.toString = function(prepend) {
                if(!prepend) {
                    prepend = "";
                }
                var ret = prepend + "<impl_interface>\n";
                if(this.name) {
                    ret += prepend + "   <interface_name>" + this.name + "</interface_name>\n";
                }
                if(this.handlerClass) {
                    ret += prepend + "   <impl_class>" + this.handlerClass + "</impl_class>\n";
                }
                ret += prepend + "</impl_interface>\n";
                return ret;
            }
        }
);